package com.howie.parnote.editor;

import com.howie.parnote.util.StringUtil;
import org.springframework.beans.propertyeditors.PropertiesEditor;

/**
 * <p>Title: parnote</p>
 * <p>
 * Description: parnote
 * </p>
 *
 * @author huangyan
 *         Created by HY on 2015/2/10 0010.
 * @version v1.0.0
 */
public class DoubleEditor extends PropertiesEditor {

	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		if (StringUtil.isEmpty(text)) {
			text = "0";
		}
		setValue(Double.parseDouble(text));
	}

	@Override
	public String getAsText() {
		return getValue().toString();
	}
}
